﻿<!--
    主框架页面
    Code: SyonLin
    Date: 2018-07-23
 -->
@{
    Layout = null;
    var BM = ViewBag.BM as SGArchiveSystem7xDB.T_Deparetment;
    var ROLEQX = ViewBag.RMD as string[];
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>@SGArchiveSystem7xCommons.SGWebInfo._sAppTitle_Eng</title>

    <!-- Global stylesheets -->
    <link href="~/Content/FrameUI/css/icons/icomoon/styles.css" rel="stylesheet" type="text/css">
    <link href="~/Content/FrameUI/css/bootstrap.css" rel="stylesheet" type="text/css">
    <link href="~/Content/FrameUI/css/core.css" rel="stylesheet" type="text/css">
    <link href="~/Content/FrameUI/css/components.css" rel="stylesheet" type="text/css">
    <link href="~/Content/FrameUI/css/colors.css" rel="stylesheet" type="text/css">
    <!-- /global stylesheets -->
    <!-- Core JS files -->
    <script type="text/javascript" src="~/Content/FrameUI/js/plugins/loaders/pace.min.js"></script>
    <script type="text/javascript" src="~/Content/FrameUI/js/core/libraries/jquery.min.js"></script>
    <script type="text/javascript" src="~/Content/FrameUI/js/core/libraries/bootstrap.min.js"></script>
    <script type="text/javascript" src="~/Content/FrameUI/js/plugins/loaders/blockui.min.js"></script>
    <!-- /core JS files -->
    <!-- Theme JS files -->
    <script type="text/javascript" src="~/Content/FrameUI/js/plugins/visualization/d3/d3.min.js"></script>
    <script type="text/javascript" src="~/Content/FrameUI/js/plugins/visualization/d3/d3_tooltip.js"></script>
    <script type="text/javascript" src="~/Content/FrameUI/js/plugins/forms/styling/switchery.min.js"></script>
    <script type="text/javascript" src="~/Content/FrameUI/js/plugins/forms/styling/uniform.min.js"></script>
    <script type="text/javascript" src="~/Content/FrameUI/js/plugins/forms/selects/bootstrap_multiselect.js"></script>
    <script type="text/javascript" src="~/Content/FrameUI/js/plugins/ui/moment/moment.min.js"></script>
    <script type="text/javascript" src="~/Content/FrameUI/js/plugins/pickers/daterangepicker.js"></script>
    <script type="text/javascript" src="~/Content/FrameUI/js/core/app.js"></script>
    <script type="text/javascript" src="~/Content/FrameUI/js/pages/dashboard.js"></script>
    <!-- /theme JS files -->
</head>
<body class="navbar-bottom">
    <!-- Main navbar -->
    <div class="navbar navbar-inverse"  style="background-image:url('../../Content/assets/img/head3.jpg');">
        <div class="navbar-header">
            <a class="navbar-brand">@ViewBag.AppTitle</a>
        </div>
        <div class="navbar-collapse collapse" id="navbar-mobile">
            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown dropdown-user">
                    <a class="dropdown-toggle" data-toggle="dropdown">
                        <i class="icon fa-circle-o-notch"></i>
                        <span id="Main_Index_myInfo">
                        </span>
                    </a>
                    <!--<ul id="Main_Index_myInfo" class="dropdown-menu dropdown-menu-right"></ul>-->
                </li>
                <li class="dropdown dropdown-user">
                    <a class="dropdown-toggle" data-toggle="dropdown">
                        <img src="~/Content/Images/user.png" alt="">
                        <span>@ViewBag.Welcome &nbsp; @ViewBag.UName （@ViewBag.BmName）</span>
                        <i class="caret"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-menu-right">
                        <li><a href="#" data-toggle="modal" data-target="#Main_Index_winModify"><i class="icon-user-plus"></i>@ViewBag.Text1</a></li>
                        <li><a href="#" onclick="Login_again()"><i class="icon-switch2"></i>@ViewBag.Text2</a></li>
                        <li><a href="#" onclick="Current_version('@ViewBag.Current_version')"><i class="icon-switch22"></i>@ViewBag.Text3</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <!-- /main navbar -->
    <!-- Page container -->
    <div class="page-container">
        <!-- Page content -->
        <div class="page-content">
            <!-- Main sidebar -->
            <div class="sidebar sidebar-main" style="width:160px;background-image:url('../../Content/assets/img/head3.jpg');background-attachment:fixed;background-repeat: no-repeat;background-size: cover;">
                <div class="sidebar-content">
                    <!-- Main navigation -->
                    <div class="sidebar-category sidebar-category-visible">
                        <div class="category-content no-padding"  id="Main_Index_left" style="overflow:auto;">
                            <ul class="navigation navigation-main navigation-accordion">
                                <!-- Main -->
                                <li class="navigation-header"><span>@ViewBag.Text4</span> <i class="icon-menu" title="Main pages"></i></li>
                                @{
                                    if (ViewBag.Menu != null)
                                    {
                                        var menus = ViewBag.Menu as List<SGArchiveSystem7x.Models.CMenuModel>;
                                        foreach (var m in menus)
                                        {
                                            <li>
                                                @{
                                                    if (m.childModel.Count() > 0)
                                                    {
                                                        <a href="#"><i class="@m.Model.MD_ICON"></i><span>@m.Model.MD_NAME</span></a>
                                                        <ul>
                                                            @{ foreach (var cm in m.childModel)
                                                                {
                                                                    string pid = cm.MD_PID.ToString();
                                                                    if (ROLEQX.Select(c => c).Where(c => c.Contains(pid)).Count() > 0)
                                                                    {
                                                                        <li><a href="#" onclick="addtabs('@cm.MD_PATH', '@m.Model.MD_NAME', '@cm.MD_NAME')">@cm.MD_NAME</a></li>
                                                                    }
                                                                    else
                                                                    {
                                                                          <li><a href="#" onclick="NoAuthority('','@m.Model.MD_NAME', '@cm.MD_NAME')">@cm.MD_NAME</a></li>
                                                                    }
                                                                }
                                                            }
                                                        </ul>
                                                    }
                                                    else
                                                    {
                                                        string pid = m.Model.MD_ID.ToString();
                                                        if (ROLEQX.Select(c => c).Where(c => c.Contains(pid)).Count() == 0)
                                                        {
                                                            <a href="#" onclick="NoAuthority('','@m.Model.MD_NAME', '')"><i class="@m.Model.MD_ICON"></i><span>@m.Model.MD_NAME</span></a>
                                                        }
                                                        else {
                                                             <a href="#" onclick="addtabs('@m.Model.MD_PATH', '@m.Model.MD_NAME', '')"><i class="@m.Model.MD_ICON"></i><span>@m.Model.MD_NAME</span></a>
                                                        }
                                                    }
                                                }
                                            </li>
                                        }
                                    }
                                }
                                <!-- /page kits -->
                            </ul>
                        </div>
                    </div>
                    <!-- /main navigation -->
                </div>
            </div>
            <!-- /main sidebar -->
            <!-- Main content -->
            <div class="content-wrapper">
                <!-- Page header -->
                <div class="page-header page-header-default" style="margin-bottom:0px">
                    <div class="breadcrumb-line">
                        <ul class="breadcrumb">
                            <li><a href="#"><i class="icon-home2 position-left"></i><span id="Main_Index_Big">@ViewBag.Text5</span></a></li>
                            <li class="active"><span id="Main_Index_Small"></span></li>
                        </ul>
                    </div>
                </div>
                <div style="margin-top:5px;margin-left:5px;margin-right:5px;">
                    <iframe scrolling="no" id="frmMain" name="main" frameborder="0" src="/AdminWorkSpace/Index" style="min-height:450px;width:100%;height:100%;"></iframe>
                    @*<iframe id="frmMain" src="/Outsiders/" frameborder="0" scrolling="no" width="100%"></iframe>*@
                </div>
            </div>
            <!-- /main content -->
        </div>
        <!-- /page content -->
    </div>
    <!-- /page container -->
    <!-- Footer -->
    <div id="Main_Index_bottom" class="navbar navbar-default navbar-fixed-bottom">
        <ul class="nav navbar-nav no-border visible-xs-block">
            <li><a class="text-center collapsed" data-toggle="collapse" data-target="#navbar-second"><i class="icon-circle-up2"></i></a></li>
        </ul>
        <div class="navbar-collapse collapse" id="navbar-second">
            <div class="navbar-right">
                <div class="navbar-text">
                    @ViewBag.Text6
                </div>
            </div>
        </div>
    </div>
    <div id="Main_Index_winModify" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h3 class="modal-title">@ViewBag.Text1</h3>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label for="name">@ViewBag.Text7 :</label>
                        <input style="width:100%" class="form-control" label="旧密码:" type="password" labelwidth="70px" labelalign="right" id="Main_Index_txtOld" />
                    </div>
                    <div class="form-group">
                        <label for="name">@ViewBag.Text8 :</label>
                        <input style="width:100%" class="form-control" label="新密码:" type="password" labelwidth="70px" labelalign="right" id="Main_Index_txtNew" />
                    </div>
                    <div class="form-group">
                        <label for="name">@ViewBag.Text8 :</label>
                        <input style="width:100%" label="确认密码:" class="form-control" type="password" labelwidth="70px" labelalign="right" id="Main_Index_txtConfirm" />
                    </div>
                    <h7><span style="color:red">@ViewBag.Text9</span></h7>
                    <input hidden="hidden" id="Main_Index_txtID" value="@ViewBag.UID" />
                </div>

                <div class="modal-footer">
                    <button class="btn btn-primary" onclick="Modify_Pwd()">确认修改</button>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        var height = document.documentElement.clientHeight; //window.screen.height-280;
        var width = document.documentElement.clientWidth; //window.screen.width;
        var d = document.getElementById("Main_Index_bottom").offsetHeight;
        var leftW = 300;
        if (width > 1200) {
            leftW = 500;
        } else if (width > 1000) {
            leftW = 350;
        } else {
            leftW = 100;
        }
        $('#frmMain').height(height - 148);// - 148);
        $('#Main_Index_left').height(height - d);
        getAjaxInfo();  

        //修改密码
        //判断输入密码的类型
        function CharMode(iN) {
            if (iN >= 48 && iN <= 57) //数字
                return 1;
            if (iN >= 65 && iN <= 90) //大写
                return 2;
            if (iN >= 97 && iN <= 122) //小写
                return 4;
            else
                return 8;
        }
        //bitTotal函数
        //计算密码模式
        function bitTotal(num) {
            modes = 0;
            for (i = 0; i < 4; i++) {
                if (num & 1) modes++;
                num >>>= 1;
            }
            return modes;
        }
        //返回强度级别
        function checkStrong(sPW) {
            if (sPW.length < 8)
                return 0; //密码太短，不检测级别
            Modes = 0;
            for (i = 0; i < sPW.length; i++) {
                //密码模式
                Modes |= CharMode(sPW.charCodeAt(i));
            }
            return bitTotal(Modes);
        }

        function Modify_Pwd() {
            var id = $('#Main_Index_txtID').val();
            var old = $('#Main_Index_txtOld').val();

            if (old == '') {
                alert('@ViewBag.Text12');
            }

            var pwd = $('#Main_Index_txtNew').val();
            var pwd1 = $('#Main_Index_txtConfirm').val();
            var v = checkStrong(pwd);
            if (v == 0) {
                alert('@ViewBag.Text10');
                return;
            }
            else if (v < 3) {
                alert('@ViewBag.Text11');
                return;
            }
            if (pwd == pwd1) {
                $.ajax({
                    url: '/Main/btnSavePassword',
                    type: 'post',
                    dataType: "text",
                    data: { old: old, pwd: pwd },
                    success: function (data) {
                        if (data == '1') {
                            alert('@ViewBag.Text13');
                            window.location.href = '/Login/Index';
                        }
                        else if(data == '-1')
                            alert('@ViewBag.Text14');
                        else if (data == '0')
                            alert('@ViewBag.Text15');
                    }
                })
            }
            else { alert('@ViewBag.Text16'); }

        }

        //显示当前版本
        function Current_version(val) {
            alert(val);
        }
        //页面跳转
        function addtabs(url, big, small) {
            document.getElementById('Main_Index_Big').innerHTML = big;
            document.getElementById('Main_Index_Small').innerHTML = small;
            document.getElementById("frmMain").src = url;// + "?name=" + big;
        }

        //重新登录
        function Login_again() {

            if (confirm("@ViewBag.Text17")) {
                $.ajax({
                    url: '/Main/JumpLogin',
                    type: 'post',
                    success: function (data) {
                        if (data == 1) {
                            window.location.href = '/Login/Index';
                        }
                    }
                });
                //window.location.href = '/Login/Index';
            }
        }

        function NoAuthority(url, big, small) {
            document.getElementById('Main_Index_Big').innerHTML = big;
            document.getElementById('Main_Index_Small').innerHTML = small;
            document.getElementById("frmMain").src = '/Main/To404Page';
        }

        function getAjaxInfo() {
            //$.ajax({
            //    url: '/Main/Get_ajaxWorkInfo',
            //    type: 'post',
            //    dataType: "html",
            //    success: function (data) {
            //        var tdn = document.getElementById('Main_Index_myInfo');
            //        tdn.innerHTML = data;
            //    }
            //})
        }

        window.onload = function () {
            ///setTimeout(getAjaxInfo, 1000 * 60 * 10); //每10分钟执行一次 
        }
    </script>
</body>
</html>

